// 创建一个路由器，并暴露出去
// 第一步：引入createRouter
import {createRouter, createWebHistory} from "vue-router";
// 引入一个一个可能要呈现组件
import Index from "@/views/Index.vue";
import Login from "@/views/admin/Login.vue";
import Admin from "@/views/admin/Admin.vue";
import Category from "@/views/product/Category.vue";
import Product from "@/views/product/Product.vue";
import User from "@/views/user/User.vue";
import Order from "@/views/order/Order.vue";
import AdminAvatar from "@/views/admin/AdminAvatar.vue";
import AdminForgotPassword from "@/views/admin/AdminForgotPassword.vue";
import AdminInfo from "@/views/admin/AdminInfo.vue";
import AdminResetPassword from "@/views/admin/AdminResetPassword.vue.vue";
import Chart from "@/views/chart/Chart.vue";

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: [
        {path: "/login", component: Login},
        {path: "/adminForgotPassword", component: AdminForgotPassword},
        {
            path: "/", component: Index, children: [
                {path: "/admin", component: Admin},
                {path: "/category", component: Category},
                {path: "/product", component: Product},
                {path: "/user", component: User},
                {path: "/order", component: Order},
                {path: "/adminAvatar", component: AdminAvatar},
                {path: "/adminInfo", component: AdminInfo},
                {path: "/adminResetPassword", component: AdminResetPassword},
                {path: "/chart", component: Chart }
            ]
        }
    ]
})

// 暴露出去router
export default router